$(function () {
    vm.reload();
});
var vm = new Vue({
    el:'#rrapp',
    data:{
        showList: true,
        title:null,
        roleList:{},
        user:{}
    },
    methods: {
        saveOrUpdate: function () {
            $.ajax({
                type: "POST",
                url: baseURL + "sys/user/updateBy",
                contentType: "application/json",
                data: JSON.stringify(vm.user),
                success: function(r){
                    if(r.code === 0){
                        alert('操作成功', function(){
                            vm.user = {};
                            vm.reload();
                        });
                    }else{
                        alert(r.msg);
                    }
                }
            });
        },
        reload: function () {
            $.get(baseURL + "sys/user/infoById", function(r){
                vm.user = r.user;
                vm.roleList = vm.user.roleList;
            });
        }
    }
});